package com.agriculture.competition.service.impl;

import com.agriculture.common.core.utils.DateUtils;
import com.agriculture.competition.domain.JaGroupUser;
import com.agriculture.competition.mapper.JaGroupUserMapper;
import com.agriculture.competition.service.IJaGroupUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 参赛组成员Service业务层处理
 *
 * @author agriculture
 * @date 2025-03-04
 */
@Service
public class JaGroupUserServiceImpl implements IJaGroupUserService {
    @Autowired
    private JaGroupUserMapper jaGroupUserMapper;

    /**
     * 查询参赛组成员
     *
     * @param id 参赛组成员主键
     * @return 参赛组成员
     */
    @Override
    public JaGroupUser selectJaGroupUserById(Long id) {
        return jaGroupUserMapper.selectJaGroupUserById(id);
    }

    /**
     * 查询参赛组成员列表
     *
     * @param jaGroupUser 参赛组成员
     * @return 参赛组成员
     */
    @Override
    public List<JaGroupUser> selectJaGroupUserList(JaGroupUser jaGroupUser) {
        return jaGroupUserMapper.selectJaGroupUserList(jaGroupUser);
    }

    /**
     * 新增参赛组成员
     *
     * @param jaGroupUser 参赛组成员
     * @return 结果
     */
    @Override
    public int insertJaGroupUser(JaGroupUser jaGroupUser) {
        jaGroupUser.setCreateTime(DateUtils.getNowDate());
        return jaGroupUserMapper.insertJaGroupUser(jaGroupUser);
    }

    /**
     * 修改参赛组成员
     *
     * @param jaGroupUser 参赛组成员
     * @return 结果
     */
    @Override
    public int updateJaGroupUser(JaGroupUser jaGroupUser) {
        jaGroupUser.setUpdateTime(DateUtils.getNowDate());
        return jaGroupUserMapper.updateJaGroupUser(jaGroupUser);
    }

    /**
     * 批量删除参赛组成员
     *
     * @param ids 需要删除的参赛组成员主键
     * @return 结果
     */
    @Override
    public int deleteJaGroupUserByIds(Long[] ids) {
        return jaGroupUserMapper.deleteJaGroupUserByIds(ids);
    }

    /**
     * 删除参赛组成员信息
     *
     * @param id 参赛组成员主键
     * @return 结果
     */
    @Override
    public int deleteJaGroupUserById(Long id) {
        return jaGroupUserMapper.deleteJaGroupUserById(id);
    }
}
